%%
kk = 1;
psnrList = cell(50, 1);
for k = kk
    line = 0;
    fid = fopen(fullfile(sranaly.path, 'PSNR_SSIM.txt'));
    while true
        tline = fgetl(fid);
        if ~ischar(tline), break; end
        
        line = line + 1;
        psnrList{line} = sranaly.extractPSNRFromTxt(strtrim(tline), k);
    end
    psnrList = psnrList(1 : line);
    
    fclose(fid);
end

%%
% imshows(psnrList(:, 1:3)); colormap jet
% figure; plot(psnrList(:, 1))

%%
psnrList = cell2mat(psnrList);
for i = 1 : size(psnrList)
    fprintf('%.2f\t', psnrList(i, :));
    fprintf('\n');
end

DataSet = {'Set5', 'Set14', 'B100', 'Urban100'};
% Methods = {'Bicubic', 'SRCNN', 'FSRCNN', 'RED', 'VDSR', 'DRRN'};
Methods = {'B', 'S', 'F', 'R', 'V', 'D'};

Scales = [2 3 4];
data_num = length(DataSet);
scale_num = length(Scales);


linespces = {
    'o-', 'color', [0    0.4470    0.7410]
    's-', 'color', [0.9290 0.6940 0.1250]
    'd-', 'color', [0.8500    0.3250    0.0980]
    };

% close all
figure;
for di = 1 : data_num
    for si = 1 : scale_num
        col = (di-1)*scale_num + si;
        subplot(scale_num, data_num, di + (si-1)*data_num);
        plot(psnrList([2 4 : 4 : end], col), linespces{1, :}); hold on
        plot(psnrList([2 5 : 4 : end], col), linespces{2, :});
        plot(psnrList([2 6 : 4 : end], col), linespces{3, :});
        
        if si == 1, title(DataSet{di}); end
        if di == 1, ylabel(sprintf('scale = %d', Scales(si))); end
        
        axis tight
        set(gca, 'xtick', 1 : 6, 'xticklabel', Methods)
    end
end

figpos = [266   258   915   385];
set(gcf, 'position', figpos);
return
